// 行情数据的生成

let Mock = require("mockjs");
let Random = Mock.Random;

/*
* @description 行情
* @export PairBefo string 交易币
* @export PairBase string 计价币
* @export PairId int 交易对id
* @export CoinId int 交易币id
* @export BaseId int 计价币id
* @export NewPrice int point(0-8) 最新价
* @export NewRmb int point(0-2) 折合人民币
* @export DayCount int point(0-8) 24h成交量
* @export Increase int point(0-2) 24h涨幅
* @export DayLow int point(0-8) 24h最低
* @export DayHigh int point(0-8) 24h最高
*/
let marketNew = [];
let marketAmount = [];
let marketList = [];
for (let i = 0; i < 30; i++) {
    let charts = [];
    for (let j = 0; j < 24; j++) {
        charts.push(
            Mock.mock({
                "data|0-1000.0-4": 100,
            }).data

        )
    }
    let obj = Mock.mock({
        "PairBefo": /^[A-Z]{3}$/,
        "PairBase|1": [
            "USDT",
            "BTC",
            "EOS",
            "ETH",
        ],
        "PairId|1-100": 50,
        "CoinId|1-100": 50,
        "BaseId|1-100": 50,
        "NewPrice|0-1000.0-8": 100,
        "NewRmb|0-10000.0-2": 1,
        "DayCount|100-10000.0-8": 100,
        "Increase|-100-100.0-2": 50,
        "DayLow|0-10.0-8": 5,
        "DayHigh|0-10.0-8": 5,
        "Charts": charts
    })
    marketNew.push(obj)
    marketAmount.push(obj)
    marketList.push(obj)

}
/*
* 新币榜的数据
*/
marketNew.map(function (item) {
    item.PairName = item.PairBefo + "/" + item.PairBase
})
/*
*24H涨幅榜的数据
*/
marketAmount.map(function (item) {
    item.PairName = item.PairBefo + "/" + item.PairBase
})
/*
*行情数据的加载
*/
marketList.map(function (item) {
    item.PairName = item.PairBefo + "/" + item.PairBase
})



/*
* 指数数据的生成，包含价格指数，USDT指数，BTC指数
*/
let length = Mock.mock({
    "number|10-20": 10
}).number;

let exponent = [];
for (var i = 0; i < length * 1; i++) {
    /*
    *图表数据的生成，默认生成60条
    */
    let charts = [];
    for (let j = 0; j < 60; j++) {
        charts.push(
            Mock.mock({
                "data|0-1000.0-4": 50,
            }).data

        )
    }
    let obj = Mock.mock({
        "PairBefo": /^[A-Z]{3}$/,
        "PairBase|1": [
            "USDT",
            "BTC",
            "EOS",
            "ETH",
        ],
        "PairId|1-100": 1,
        "NewPrice|0-10.0-8": 1,
        "NewRmb|100-10000.0-2": 10,
        "Increase|-100-100.0-2": 1,
        "DayHeigh|100-10000.0-2": 10,
        "DayLow|100-10000.0-2": 10,
        "Charts": charts,
    })
    exponent.push(
        obj
    )
}
/*
* 价格指数
*/
console.log("生成的数据", exponent)
exponent.map(function (item) {
    item.PairName = item.PairBefo + "/" + item.PairBase
})
let exponentPrice = exponent
/*
* USDT指数
*/
let exponentUSDT = exponent
/*
* 

BTC指数
*/
let exponentBTC = exponent
console.log("ad", exponentPrice)
export default {
    marketNew,
    marketAmount,

    marketList,

    exponentPrice,
    exponentUSDT,
    exponentBTC,
}